import { fromJS } from 'immutable'
import * as constant from './constant'
const defaultState = fromJS({
    remmendList: [],
    // articleList: [],
    boardList: [],
    // writerList: [],
    articlePage: 1
})
export default((state = defaultState,action) => {
   switch( action.type ){
       case constant.CHANGE_HOME_DATA:
        return state.merge({
            remmendList: fromJS(action.remmendList),
            // articleList: fromJS(action.articleList),
            // writerList: fromJS(action.writerList),
            boardList: fromJS(action.boardList)
        })
        case constant.GET_MORE_ARTICLE:
        return state.merge({
            'articleList': state.get('articleList').concat(action.list),
            'articlePage': action.nextPage
        })
       default: 
        return state;
   }
})